using System;
using Aurora.TaskScheduler.Abstractions.BaseModel;
using Microsoft.Extensions.DependencyInjection;

namespace Aurora.TaskScheduler.Dashboard;

public class DashboardTaskSchedulerOptionExtension : ITaskScheduleOptionsExtension
{
    private readonly Action<DashboardOptions> _configure;

    public DashboardTaskSchedulerOptionExtension(Action<DashboardOptions> configure)
    {
        _configure = configure;
    }

    public void AddServices(IServiceCollection services)
    {
        services.AddRazorPages();
        services.AddHttpContextAccessor();
        // services.Configure<DashboardOptions>(c => { c.PathBase = "/QuartzUI"; });
        services.Configure(_configure);

        services.ConfigureOptions<DashboardResourceOptions>();
    }
}